Xbasic
RANDOM_RECORDS Function
Syntax
Filter_Expression as C = random_records(count as n[,filter as c])
Arguments
- Filter_Expression
An expression that selects records from a table.
- count
An integer number greater than 0. The count of records to return.
- filter
Optional. Default = ".T." (All records). A character filter expression that evaluates to a logical value and selects records from the table.
Description
Return 'count' random records.
Discussion
RANDOM_RECORDS() is a special function used only in queries to return a random number of records from the current table. If the optional Filter is supplied, the random records are selected from the records selected by the filter.
See Top, Bottom, Nth Record and Random Record Queries for more information. The following query returns 10 randomly selected orders placed after May 1, 2000.
dim tbl as P dim inx as P tbl = table.current() query.filter = "random_records(10, \"orderdate > {5/1/2000}\")" query.order = "order_total" inx = tbl.query_create() topparent.resynch()
See Also